home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / studioTransOptions.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.7 KB  |  133 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. // Copyright (C) 1997-2002 Alias|Wavefront,
  18. // a division of Silicon Graphics Limited.
  19. //
  20. // The information in this file is provided for the exclusive use of the
  21. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  22. // and incorporate this code into other products for purposes authorized
  23. // by the Alias|Wavefront license agreement, without fee.
  24. //
  25. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  26. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  27. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  28. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  29. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  30. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  31. // PERFORMANCE OF THIS SOFTWARE.
  32. //
  33. global proc int studioTransOptions ( string $parent, string $action,
  34.                                     string $initialOptions, string $resultCallback )
  35. //
  36. //    Description:
  37. //        This script posts the Studio Packet file accessor options.
  38. //
  39. //    Parameters:
  40. //        $parent    - the elf parent layout for this options layout. It is
  41. //                    always a scrollLayout.
  42. //        $action    - the action that is to be performed with this invokation
  43. //                    of this proc. Valid options are:
  44. //                        "query" - construct the options string and pass it
  45. //                                    to the resultCallback.
  46. //                        "post"    - post all the elf controls.
  47. //        $resultCallback    -
  48. //                This is the proc to be called with the result string. 
  49. //                resultCallback ( string $optionsString )
  50. //
  51. //    Returns:
  52. //        1 if successfull.
  53. //        0 otherwise.
  54. //
  55. {
  56.     int      $result;
  57.     string    $currentOptions;
  58.     string     $optionList[];
  59.     string     $optionBreakDown[];
  60.     int        $index;
  61.     int        $value;
  62.     string    $AxisOption = "Axis";
  63.     string    $RayTraceOption = "Raytrace";
  64.     string    $UseCamerasOption = "useCameras";
  65.     
  66.     if ($action == "post") {
  67.         setUITemplate -pushTemplate DefaultTemplate;
  68.         setParent $parent;
  69.  
  70.         radioButtonGrp
  71.                     -l "Up Axis:"
  72.                     -nrb 3
  73.                     -la3 "Y" "Z" "From File"
  74.                     -sl 1
  75.                     spfAxisGrpBox;
  76.         checkBoxGrp
  77.                     -l "Raytrace:"
  78.                     -ncb 1
  79.                     spfRaytraceChkBox;
  80.         checkBoxGrp
  81.                     -l "Include Cameras:"
  82.                     -ncb 1
  83.                     spfUseCamerasChkBox;
  84.  
  85.         // Now set to current settings.
  86.         //
  87.         $currentOptions = $initialOptions;
  88.  
  89.         if (size($currentOptions) > 0) {
  90.             tokenize($currentOptions, ";", $optionList);
  91.             for ($index = 0; $index < size($optionList); $index++) {
  92.                 tokenize($optionList[$index], "=", $optionBreakDown);
  93.                 if ($optionBreakDown[0] == $AxisOption ) {
  94.                     $value = int( $optionBreakDown[1] );
  95.                     if ($value == 0) {
  96.                         radioButtonGrp -e -sl 1 spfAxisGrpBox;
  97.                     } else if ($value == 1) {
  98.                         radioButtonGrp -e -sl 2 spfAxisGrpBox;
  99.                     } else {
  100.                         radioButtonGrp -e -sl 3 spfAxisGrpBox;
  101.                     }
  102.                 } else if ($optionBreakDown[0] == $RayTraceOption) {
  103.                     $value = int( $optionBreakDown[1] );
  104.                     if ($value == 1) {
  105.                         checkBoxGrp -e -v1 1 spfRaytraceChkBox;
  106.                     }
  107.                 } else if ($optionBreakDown[0] == $UseCamerasOption) {
  108.                     $value = int( $optionBreakDown[1] );
  109.                     if ($value == 1) {
  110.                         checkBoxGrp -e -v1 1 spfUseCamerasChkBox;
  111.                     }
  112.                 }
  113.             }
  114.         }
  115.         setUITemplate -popTemplate;
  116.  
  117.         $result = 1;
  118.     } else if ($action == "query") {
  119.         $value = `radioButtonGrp -q -sl spfAxisGrpBox` - 1;
  120.         $currentOptions = $currentOptions + $AxisOption + "=" + $value;
  121.         $value = `checkBoxGrp -q -v1 spfRaytraceChkBox`;
  122.         $currentOptions = $currentOptions + ";" + $RayTraceOption + "=" + $value;
  123.         $value = `checkBoxGrp -q -v1 spfUseCamerasChkBox`;
  124.         $currentOptions = $currentOptions + ";" + $UseCamerasOption + "=" + $value;
  125.         eval($resultCallback+" \""+$currentOptions+"\"");
  126.         $result = 1;
  127.     } else {
  128.         $result = 0;
  129.     }
  130.     
  131.     return $result;
  132. }
  133.